package com.reach.redis.bean;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.reach.redis.manager.ManagerCache;
import com.reach.redis.manager.SpringContextUtil;

public class CacheBean {

	
	public static final Map<String,Object> cacheMap = new ConcurrentHashMap<>();

	public static Object get(String k) {
		Object obj =  cacheMap.get(k);
		if(obj == null || !ManagerCache.enableCache) {
			SpringContextUtil.getBean(k);
		}
		return obj;
	}
	

	public static void add(String k,Object v) {
		cacheMap.put(k, v);
	}
}
